"""
票务数据模型
"""
from pydantic import BaseModel
from typing import Optional, List
from datetime import datetime

class Show(BaseModel):
    """演出信息模型"""
    id: str
    name: str
    description: Optional[str] = None
    date: str
    time: str
    venue: str
    address: str
    city: str
    category: str
    poster: str
    min_price: int
    max_price: int
    status: str
    tags: List[str] = []

class Session(BaseModel):
    """场次信息模型"""
    id: str
    show_id: str
    date: str
    time: str
    description: str
    status: str
    total_tickets: int
    available_tickets: int

class PriceRange(BaseModel):
    """价位信息模型"""
    id: str
    show_id: str
    session_id: str
    range_name: str
    price: int
    available_count: int
    total_count: int

class RushConfig(BaseModel):
    """抢票配置模型"""
    id: str
    user_id: str
    show_id: str
    session_id: str
    price_range: str
    ticket_count: int
    rush_time: Optional[datetime] = None
    auto_submit: bool = True
    retry_count: int = 3
    retry_interval: int = 1
    created_at: datetime
    updated_at: datetime

class RushResult(BaseModel):
    """抢票结果模型"""
    id: str
    config_id: str
    status: str  # success, failed, pending
    message: Optional[str] = None
    order_id: Optional[str] = None
    order_amount: Optional[float] = None
    created_at: datetime
    completed_at: Optional[datetime] = None
    screenshot: Optional[str] = None